I have changed the original coding using here protoype functions
that the callback procedures will use.
The local functions that will be actually called by the procedures are
set in SetupMyVectors fn.
*/
def fn Proto_PlacardDraw( c as ControlRef, dummy as SInt16 ) using gPlacardDrawProc
def fn Proto_AcceptDrag( browser as ControlRef, theDrag as DragReference, itemID as DataBrowserItemID ) using gAcceptDragProc
def fn Proto_ReceiveDrag( browser as ControlRef, theDrag as DragReference, itemID as DataBrowserItemID ) using gReceiveDragProc
def fn Proto_AddDragItem( browser as ControlRef, theDrag as DragReference, inItemID as DataBrowserItemID, itemRef as .ItemReference ) using gAddDragItemProc
def fn Proto_GetSetItemData( browser as ControlRef, itemID as DataBrowserItemID, prop as DataBrowserPropertyID, itemData as DataBrowserItemDataRef, changeValue as Boolean ) using gGetSetItemDataProc
def fn Proto_ItemComparison( browser as ControlRef, itemOneID as DataBrowserItemID, itemTwoID as DataBrowserItemID, sortProperty as DataBrowserPropertyID ) using gItemComparisonProc
def fn Proto_ItemNotification( browser as ControlRef, itemID as DataBrowserItemID, message as DataBrowserItemNotification ) using gItemNotificationProc
def fn Proto_ItemHelpContent(browser as ControlRef,item as DataBrowserItemID,prop as DataBrowserPropertyID,inRequest as HMContentRequest,outContentProvided as .HMContentProvidedType, ioHelpContent as .HMHelpContentRec ) using gItemHelpContentProc
def fn Proto_ContextualMenu( browser as ControlRef, contextualMenu as .MenuRef, helpType as .UInt32, helpItemString as .CFStringRef, selection as .AEDesc ) using gGetContextualMenuProc
def fn Proto_SelectContextualMenu( browser as ControlRef, contextualMenu as MenuRef, selectionType as UInt32, menuID as SInt16, menuItem as MenuItemIndex ) using gSelectContextualMenuProc
def fn Proto_DialogEventHandler( EventHandlerCallRef as ptr, inEvent as EventRef, void as ptr ) using gDialogEventHandlerProc
def fn Proto_WindowEventHandler( EventHandlerCallRef as ptr, inEvent as EventRef, void as ptr ) using gWindowEventHandlerProc
'~';
'~-
'~Utility Functions
def fn InstallWindowEventHandler( t, h, n, @l, @u, @r ) = fn InstallEventHandler( fn GetWindowEventTarget( t ), h, n, #l, #u, #r )
def fn SendEventToWindow( e, t ) = fn SendEventToEventTarget( e, fn GetWindowEventTarget( t ) )
/*
This is a dummy function, never called by the program, just
here to store string lists (easier to edit in the source code)
end fn = _true // for automatic transluscent dragging
'~DataBrowser Setting & Getting Data
'~'1
/*
This function is called via a callback procedure. This is
the only required routine to work with a DataBrowser control.
The DataBrowser asks you to setup some values for the cells
that it must display. Those values are set with specific functions
depending on the type of the cell to be updated.
With the same callback routine the DataBrowser may inform you
that a cell has been changed by the end user, so it is time
to get the value sent by the DataBrowser to update your
internal information.
Here, we don't have a real set of items to update, since
they are faked with calculation.
*/
clear local fn MyGetSetItemData( browser as ControlRef, itemID as DataBrowserItemID, prop as DataBrowserPropertyID, itemData as DataBrowserItemDataRef, changeValue as Boolean )
This function is invoked by a callback procedure when it is
time for the program to provide help content for help tags.
*/
clear local fn MyItemHelpContent( browser as ControlRef, item as DataBrowserItemID, prop as DataBrowserPropertyID, inRequest as HMContentRequest, outContentProvided as .HMContentProvidedType, ioHelpContent as .HMHelpContentRec )
dim as HMHelpContent helpContent // temporary HMHelpContent record
This function is called via a callback procedure when the
DataBrowser needs a contextual menu to display.
*/
clear local fn MyGetContextualMenu( browser as ControlRef, @contextualMenu as .MenuRef, helpType as .UInt32, @helpItemString as .CFStringRef, selection as .AEDesc )
This function is called by the DataBrowser via a callback
routine when the end user has chosen an item in a contextual menu.
*/
clear local fn MySelectContextualMenu( browser as ControlRef, contextualMenu as MenuRef, selectionType as UInt32, menuID as SInt16, menuItem as MenuItemIndex )
dim as str255 s
GetMenuItemText( contextualMenu, menuItem, s )
long if gContextualMenu = _nil
DeleteMenu( _contextualMenuResID )
DisposeMenu( contextualMenu )
end if
fn ShowMe( s )
end fn
'~DataBrowser Placard Drawing
'~'1
/*
This function is called by a callback procedure installed
in a placard control, so that it updates itself at the
right location on screen with the right info.
*/
clear local fn MyPlacardDraw( c as ControlRef, dummy as SInt16 )
enterproc fn GetSetItemDataProc( browser as ControlRef, itemID as DataBrowserItemID, prop as DataBrowserPropertyID, itemData as DataBrowserItemDataRef, changeValue as Boolean ) = OSStatus
enterproc fn ItemComparisonProc( browser as ControlRef, itemOneID as DataBrowserItemID, itemTwoID as DataBrowserItemID, sortProperty as DataBrowserPropertyID ) = Boolean
enterproc ItemHelpContentProc( browser as ControlRef, item as DataBrowserItemID, prop as DataBrowserPropertyID, inRequest as HMContentRequest, outContentProvided as .HMContentProvidedType, ioHelpContent as .HMHelpContentRec )
enterproc GetContextualMenuProc( browser as ControlRef, @contextualMenu as .MenuRef, helpType as .UInt32, @helpItemString as .CFStringRef, selection as .AEDesc )
enterproc SelectContextualMenuProc( browser as ControlRef, contextualMenu as MenuRef, selectionType as UInt32, menuID as SInt16, menuItem as MenuItemIndex )